package org.lc.design.samples.case1;

import java.util.Properties;

/**
* 配置管理器单例
* @author lc
* @date 2024/7/8
*/
public class ConfigureManager {

    private static ConfigureManager instance;

    private Properties properties;

    private ConfigureManager() {
        properties = new Properties();
        properties.setProperty("appName", "单例模式模拟");
        properties.setProperty("port", "8081");
    }

    public static ConfigureManager getInstance() {
        if(instance == null) {
            instance = new ConfigureManager();
        }
        return instance;
    }

    public String getConfig(String key) {
        return properties.getProperty(key);
    }
}
